<?php
namespace Admin\Model;
use Think\Model;
class UserModel extends Model{
  
    public function set_xj_userstatus($userid){

        $userinfo = M('user')->find($userid);
        $save_sj['id']=$userid;
        $up_id=$userinfo['invite_id'];
        $up_userinfo = M('user')->find($up_id);
        $up_status=$up_userinfo['status'];
        $jb=M('jbset')->find();
         $con['invite_id']=$userinfo['id'];
	        switch ($userinfo['status']) {

                    case '1':
                       $con['status']=1;
                       $yq_num=$this->where($con)->count();
                       if ($yq_num>= $jb['sj_jb2_jb1s']) {
                           $save_sj['sj_invite']=1;
                           $this->save($save_sj);
                       }

                        break;
                    case '2':

                    $con['status']=2;
                       $yq_num=$this->where($con)->count();
                       if ($yq_num>= $jb['sj_jb3_jb2s']) {
                           $save_sj['sj3_invite']=1;
                           $this->save($save_sj);
                       }
                        break;
                    case '3':

                    $con['status']=3;
                       $yq_num=$this->where($con)->count();
                       if ($yq_num>= $jb['sj_jb4_jb3s']) {
                           $save_sj['sj4_invite']=1;
                           $this->save($save_sj);
                       }
                        break;
                    
                    default:

            }	
     


     }



     
     
}


